package org.lee.other.ext;

/**
 * Aniamal
 *
 * @author dralee
 * @date 2022-02-14 13:45:21
 **/
public class Animal {
    private int id;
    private String name;

    public Animal(int id, String name) {
        this.id = id;
        this.name = name;
    }

    public void eat() {
        System.out.println("动物在吃");
    }

    public Animal info() {
        return this;
    }

    public final void print() {
        System.out.println("this is a final method couldn't be override by sub class.");
    }

    public static void hello() {
        System.out.println("this static method couldn't be override but for define again");
    }

    void def() {
        System.out.println("default access method could override by subclass in the same package, but not for other package");
    }

    public void tryException(String str) throws IllegalArgumentException {
        System.out.println("Animal tryException " + str);
    }
    
    public void doIt() {
        System.out.println("Animal do it.");
    }
}
